import React, { useContext, useState } from 'react';
import { Radio } from 'antd';
import { ConfigPostman } from './ConfigPostman';
import { OptionsSet } from './OptionsSet';
import { ConfigsContext } from '../..';
export function ConfigOptions(props) {
  var handleChangePropValue = props.handleChangePropValue;
  var _a = useContext(ConfigsContext),
    activeSchema = _a.activeSchema,
    schemaListOptions = _a.schemaListOptions;
  var postman = activeSchema.current.configs.postman;
  var _b = useState(postman ? 'dynamic' : 'static'),
    dataType = _b[0],
    setDataType = _b[1];
  var handleChangeDataType = function (e) {
    var newType = e.target.value;
    if (newType === 'static') {
      activeSchema.current.configs.postman = undefined;
    } else {
      activeSchema.current.configs.postman = {
        propName: 'options',
        method: 'get',
        url: 'https://www.',
        params: [],
        data: [],
        responseNamepath: 'RESPONSE.'
      };
    }
    setDataType(newType);
  };
  return React.createElement(
    'div',
    null,
    React.createElement('strong', null, 'options\uFF1A'),
    React.createElement(
      Radio.Group,
      { size: 'small', value: dataType, buttonStyle: 'solid', onChange: handleChangeDataType },
      React.createElement(Radio.Button, { value: 'static' }, '\u9759\u6001\u6570\u636E'),
      React.createElement(Radio.Button, { value: 'dynamic' }, '\u8FDC\u7A0B\u6570\u636E')
    ),
    React.createElement(
      'div',
      { className: 'configs-area' },
      dataType === 'static'
        ? React.createElement(OptionsSet, { handleChange: handleChangePropValue })
        : React.createElement(ConfigPostman, null)
    )
  );
}
